package b3.widget.match
{
	import b3.config.*;
	import b3.net.*;
	import b3.model.*;
	import b3.widget.tab.*;
	
	import flash.filters.*;
	import flash.text.*;

	public class MatchResultTab extends Tab
	{
		private var rankType:int;
		private var myRanking:TextField;
		
		//0, 日排行; 1, 周排行; 2, 月排行; 3, 总排行	
		public function MatchResultTab(rankType:int)
		{
			this.rankType = rankType;
			super(MatchConfig.RANK_NAME[rankType], 1, 6, 1);
			//排名
			var rankingText:TextField = new TextField();
			rankingText.selectable = false;
        	rankingText.autoSize = TextFieldAutoSize.LEFT;
			rankingText.defaultTextFormat = new TextFormat("微软雅黑", 14, 0x66FF, true);
			rankingText.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			rankingText.x = 20;
			rankingText.y = -28;
			rankingText.text = "排名";
			addChild(rankingText);
			//用户名字
			var playerNameText:TextField = new TextField();
			playerNameText.selectable = false;
        	playerNameText.autoSize = TextFieldAutoSize.CENTER;
			playerNameText.defaultTextFormat = new TextFormat("微软雅黑", 14, 0x66FF, true);
			playerNameText.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			playerNameText.x = 115;
			playerNameText.y = -28;
			playerNameText.text = "用户名称";
			addChild(playerNameText);
			//人口
			var numText:TextField = new TextField();
			numText.selectable = false;
        	numText.autoSize = TextFieldAutoSize.CENTER;
			numText.defaultTextFormat = new TextFormat("微软雅黑", 14, 0x66FF, true);
			numText.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			numText.x = 210;
			numText.y = -28;
			numText.text = "建筑人口";
			addChild(numText);
			//人口
			var buildDateText:TextField = new TextField();
			buildDateText.selectable = false;
        	buildDateText.autoSize = TextFieldAutoSize.LEFT;
			buildDateText.defaultTextFormat = new TextFormat("微软雅黑", 14, 0x66FF, true);
			buildDateText.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			buildDateText.x = 280;
			buildDateText.y = -28;
			buildDateText.text = "建筑时间";
			addChild(buildDateText);
			//我的排名
			myRanking = new TextField();
			myRanking.selectable = false;
        	myRanking.autoSize = TextFieldAutoSize.LEFT;
			myRanking.defaultTextFormat = new TextFormat("微软雅黑", 14, 0x000000);
			myRanking.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			myRanking.text = "我的" + MatchConfig.RANK_NAME[rankType] + ": 未排名";
			myRanking.x = 200;
			myRanking.y = 228;
			addChild(myRanking);
		}
		
		public function setMyRanking(ranking:int):void
		{
			if (ranking >= 0)
				myRanking.text = "我的" + MatchConfig.RANK_NAME[rankType] + ": " + (ranking + 1).toString();
			else
				myRanking.text = "我的" + MatchConfig.RANK_NAME[rankType] + ": 未排名";
		}
		
	}
}